﻿using IcicleFramework.Components.Actions;
using IcicleFramework.Components.Renderable;
using IcicleFramework.Renderables;
using Microsoft.Xna.Framework;

namespace TestBed.Components.Actions
{
    public class PlayerColorChangeAction : ImmediateAction
    {
        public override IAction DeepClone()
        {
            return new PlayerColorChangeAction();
        }

        protected override void Execute(GameTime gameTime)
        {
            //Get the renderable.
            var renderComp = ParentGameObject.GetComponent<IRenderComponent>();
            var renderable = (SingleColorRenderable) renderComp.GetRenderable(0);

            //Change the color
            renderable.ColorChannel = (Color) ActionData.Data["color"];

            base.Execute(gameTime);
        }
    }
}
